<template>
	<view class="search">
		<view class="search-input">
			<input class="input" type="text" placeholder="请输入关键字" v-model="keyWord" @input="onInputOne()"  />
		</view>
		<view v-if="productList.length > 0">
			
		</view>
		<view class="search-history" v-else>
			<view class="titles search-history-title">
				搜索历史
			</view>
			<view class="search-history-content">
				<span class="search-items" v-for="(item,index) in searchHistory" @tap="handleHistory(item.id, item.content)" :key="index">
					{{item.content}}
				</span>
			</view>
		</view>
		<view class="search-find">
			<view class="titles search-find-title">
				热搜排行榜
			</view>
			<view class="search-find-content">
				<span class="search-items" v-for="(item,index) in searchHistory" @tap="handleHistory(item.id, item.content)" :key="index">
					{{item.content}}
				</span>
			</view>
		</view>
	</view>
</template>

<script>
	import { queryOrdersByPrarmSt } from '@/api/new.js'
	export default {
		data() {
			return {
				keyWord: '',
				productList: [],
				queryOrdersByPrarm:'',
				searchHistory: [
					{
						id: 1,
						content: '毛巾'
					},
					{
						id: 2,
						content: '日常用品'
					},
					{
						id: 1,
						content: '羽毛球'
					}
				]
			}
		},
		mounted () {
			
		},
		
		methods: {
			handleHistory () {},
			onInputOne(){
				let data = {
					receiverAddress:this.keyWord,
				}
				queryOrdersByPrarmSt(data).then(res => {
					this.queryOrdersByPrarm = res.data.data
					
				})
			}
		}
	}
</script>

<style scoped>
.search {
	padding: 20rpx;	
}
.search-history {
	margin-bottom: 40rpx;
}
.search-input {
	border: 1px solid #999;
	border-radius: 20rpx;
	padding-left: 26rpx;
	height: 60rpx;
	line-height: 60rpx;
	margin-bottom: 40rpx;
}
/deep/.uni-input-placeholder {
	padding-top: 10rpx;
	height: 60rpx;
	line-height: 60rpx;
	font-size: 28rpx;
}
/deep/.uni-input-input {
	padding-top: 10rpx;
	height: 60rpx;
	line-height: 60rpx;
	font-size: 28rpx;
}
.titles {
	font-size: 36rpx;
	color: #333;
	margin-bottom: 15rpx;
}
input {}
.search-items {
	display: inline-block;
	padding: 0 20rpx;
	line-height: 50rpx;
	font-size: 24rpx;
	margin: 20rpx;
	border-radius: 20rpx;
	background-color: #efefef;
}
</style>
